//
//  GQHCustomCell.m
//  Xanthium
//
//  Created by GuanQinghao on 28/02/2018.
//  Copyright © 2018 GuanQinghao. All rights reserved.
//

#import "GQHCustomCell.h"
#import "GQHHeader.h"


static const CGFloat singleMargin = 16.0f;
static const CGFloat doubleMargin = 2 * singleMargin;


#pragma mark -------------------------------------------------------------------
/// 纯文本 单行单列 TextSingle
@implementation GQHCustomTextSingleCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_textLabel = [[UILabel alloc] init];
    _qh_textLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_textLabel];
    [_qh_textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.top.and.bottom.mas_equalTo(self.contentView);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.bottom.mas_equalTo(self.contentView);
        make.height.mas_equalTo(1);
    }];
}

@end


/// 纯文本 水平双文本 TextDoubleHorizontal
@implementation GQHCustomTextDoubleHorizontalCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface
{
    _qh_leftLabel = [[UILabel alloc] init];
    _qh_leftLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_leftLabel];
    [_qh_leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(self.contentView.mas_centerX);
        make.top.and.bottom.mas_equalTo(self.contentView);
    }];
    
    _qh_rightLabel = [[UILabel alloc] init];
    _qh_rightLabel.textAlignment = NSTextAlignmentRight;
    _qh_rightLabel.textColor = [UIColor darkGrayColor];
    [self.contentView addSubview:_qh_rightLabel];
    [_qh_rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(self.contentView);
        make.left.mas_equalTo(self.contentView.mas_centerX);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.bottom.mas_equalTo(self.contentView);
        make.height.mas_equalTo(1);
    }];
}

@end


/// 纯文本 垂直双文本 TextDoubleVertical
@implementation GQHCustomTextDoubleVerticalCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_upLabel = [[UILabel alloc] init];
    _qh_upLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_upLabel];
    [_qh_upLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.left.and.right.mas_equalTo(self.contentView).inset(singleMargin);
        make.bottom.mas_equalTo(self.contentView.mas_centerY);
    }];
    
    _qh_downLabel = [[UILabel alloc] init];
    _qh_downLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_downLabel];
    [_qh_downLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView.mas_centerY);
        make.left.and.bottom.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.bottom.mas_equalTo(self.contentView);
        make.height.mas_equalTo(1);
    }];
}

@end


#pragma mark -------------------------------------------------------------------
/// 我的货源-报价信息页面Cell
@implementation GQHQuotationDetailCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_avatarImageView = [[UIImageView alloc] init];
    _qh_avatarImageView.image = [UIImage qh_imageWithColor:kAppRedColor];
    _qh_avatarImageView.layer.cornerRadius = 5.0f;
    _qh_avatarImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_qh_avatarImageView];
    [_qh_avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).with.inset(10.0f);
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.size.mas_equalTo(CGSizeMake(60.0f, 60.0f));
    }];
    
    _qh_nameLabel = [[UILabel alloc] init];
    _qh_nameLabel.font = kDefaultFont;
    _qh_nameLabel.textColor = kDarkBlackColor;
    _qh_nameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_nameLabel];
    [_qh_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_avatarImageView);
        make.left.mas_equalTo(_qh_avatarImageView.mas_right).with.offset(10.0f);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_nameLabel.mas_bottom);
        make.left.and.right.and.height.mas_equalTo(_qh_nameLabel);
    }];
    
    _qh_quoteLabel = [[UILabel alloc] init];
    _qh_quoteLabel.font = kSmallerFont;
    _qh_quoteLabel.textColor = kAppGreenColor;
    _qh_quoteLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_quoteLabel];
    [_qh_quoteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.left.and.right.and.height.mas_equalTo(_qh_contentLabel);
    }];
    
    UIView *spliterView = [[UIView alloc] init];
    spliterView.backgroundColor = kLightGrayColor;
    [self addSubview:spliterView];
    [spliterView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.bottom.mas_equalTo(_qh_quoteLabel.mas_bottom).with.offset(10);
        make.height.mas_equalTo(1);
    }];
    
    _qh_contractButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_contractButton.layer.cornerRadius = 5.0f;
    _qh_contractButton.layer.masksToBounds = YES;
    _qh_contractButton.titleLabel.font = kSmallerFont;
    _qh_contractButton.backgroundColor = kAppGreenColor;
    [_qh_contractButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_contractButton addTarget:self action:@selector(createOrCheckOrCancelContract:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_contractButton];
    [_qh_contractButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(spliterView.mas_bottom).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(30);
    }];
    
    _qh_dialButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_dialButton.layer.cornerRadius = 5.0f;
    _qh_dialButton.layer.masksToBounds = YES;
    _qh_dialButton.titleLabel.font = kSmallerFont;
    _qh_dialButton.backgroundColor = kAppYellowColor;
    [_qh_dialButton setTitle:@"联系司机" forState:UIControlStateNormal];
    [_qh_dialButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_dialButton addTarget:self action:@selector(dialMobile:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_dialButton];
    [_qh_dialButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(spliterView.mas_bottom).with.offset(10);
        make.right.mas_equalTo(_qh_contractButton.mas_left).with.inset(10);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(30);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.and.bottom.mas_equalTo(self);
        make.height.mas_equalTo(5);
    }];
}

- (IBAction)createOrCheckOrCancelContract:(UIButton *)sender {
    DLog(@"发送或查看或取消协议");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_createOrCheckOrCancelContract:)]) {
        
        [_qh_delegate qh_createOrCheckOrCancelContract:sender];
    }
}

- (IBAction)dialMobile:(UIButton *)sender {
    DLog(@"拨打电话");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_dialMobile:)]) {
        
        [_qh_delegate qh_dialMobile:sender];
    }
}

@end



/// 我的货源列表Cell
@implementation GQHSuppliesCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {

    _qh_routeLabel = [[UILabel alloc] init];
    _qh_routeLabel.font = kDefaultFont;
    _qh_routeLabel.textColor = kDarkBlackColor;
    _qh_routeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_routeLabel];
    [_qh_routeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(self.contentView).with.multipliedBy(0.3);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_routeLabel.mas_bottom);
        make.left.mas_equalTo(_qh_routeLabel);
        make.right.mas_equalTo(self.contentView).inset(singleMargin + 90);
        make.height.mas_equalTo(self.contentView).with.multipliedBy(0.2);
    }];
    
    _qh_loadingTimeLabel = [[UILabel alloc] init];
    _qh_loadingTimeLabel.font = kSmallerFont;
    _qh_loadingTimeLabel.textColor = kDarkGrayColor;
    _qh_loadingTimeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_loadingTimeLabel];
    [_qh_loadingTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(self.contentView).with.multipliedBy(0.2);
    }];
    
    _qh_onSaleButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_onSaleButton.layer.cornerRadius = 5.0f;
    _qh_onSaleButton.layer.borderColor = kAppGreenColor.CGColor;
    _qh_onSaleButton.layer.borderWidth = 1.0f;
    _qh_onSaleButton.layer.masksToBounds = YES;
    _qh_onSaleButton.titleLabel.font = kDefaultFont;
    [_qh_onSaleButton setTitleColor:kAppGreenColor forState:UIControlStateNormal];
    [_qh_onSaleButton addTarget:self action:@selector(onSaleOrNot:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_onSaleButton];
    [_qh_onSaleButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(30);
    }];
    
    _qh_checkQuotationButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_qh_checkQuotationButton setBackgroundColor:kLightGrayColor];
    [_qh_checkQuotationButton setTitleColor:kDarkGrayColor forState:UIControlStateNormal];
    _qh_checkQuotationButton.titleLabel.font = kSmallerFont;
    _qh_checkQuotationButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [_qh_checkQuotationButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 20, 0, 0)];
    _qh_checkQuotationButton.titleLabel.textAlignment = NSTextAlignmentLeft;
    [_qh_checkQuotationButton addTarget:self action:@selector(checkQutation:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_checkQuotationButton];
    [_qh_checkQuotationButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_loadingTimeLabel.mas_bottom);
        make.left.and.right.mas_equalTo(self.contentView);
        make.height.mas_equalTo(self.contentView).with.multipliedBy(0.3);
    }];
}

- (IBAction)checkQutation:(UIButton *)sender {
    DLog(@"查看报价情况");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_checkQutation:)]) {
        
        [_qh_delegate qh_checkQutation:sender];
    }
}

- (IBAction)onSaleOrNot:(UIButton *)sender {
    DLog(@"上架或下架货源");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_onSaleOrNot:)]) {
        
        [_qh_delegate qh_onSaleOrNot:sender];
    }
}

@end



/// 我的报价单列表Cell代理
@implementation GQHQutationCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_amountLabel = [[UILabel alloc] init];
    _qh_amountLabel.font = kDefaultFont;
    _qh_amountLabel.textColor = kAppRedColor;
    _qh_amountLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_amountLabel];
    [_qh_amountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).with.inset(10);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(self.contentView.mas_centerX);
        make.height.mas_equalTo(20);
    }];
    
    _qh_statusLabel = [[UILabel alloc] init];
    _qh_statusLabel.font = kDefaultFont;
    _qh_statusLabel.textColor = kAppGreenColor;
    _qh_statusLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_qh_statusLabel];
    [_qh_statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_amountLabel);
        make.left.mas_equalTo(self.contentView.mas_centerX);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(_qh_amountLabel);
    }];
    
    UIView *splitorView = [[UIView alloc] init];
    splitorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:splitorView];
    [splitorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.bottom.mas_equalTo(_qh_amountLabel).with.offset(10);
        make.height.mas_equalTo(1);
    }];
    
    _qh_routeLabel = [[UILabel alloc] init];
    _qh_routeLabel.font = kBiggerFont;
    _qh_routeLabel.textColor = kDarkBlackColor;
    _qh_routeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_routeLabel];
    [_qh_routeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView.mas_bottom).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(30);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font= kDefaultFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_routeLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(20);
    }];
    
    _qh_loadingTimeLabel = [[UILabel alloc] init];
    _qh_loadingTimeLabel.font= kDefaultFont;
    _qh_loadingTimeLabel.textColor = kDarkGrayColor;
    _qh_loadingTimeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_loadingTimeLabel];
    [_qh_loadingTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(20);
    }];
    
    _qh_loaderLabel = [[UILabel alloc] init];
    _qh_loaderLabel.font= kDefaultFont;
    _qh_loaderLabel.textColor = kDarkGrayColor;
    _qh_loaderLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_loaderLabel];
    [_qh_loaderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_loadingTimeLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(20);
    }];
    
    _qh_mileageLabel = [[UILabel alloc] init];
    _qh_mileageLabel.font= kDefaultFont;
    _qh_mileageLabel.textColor = kDarkGrayColor;
    _qh_mileageLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_mileageLabel];
    [_qh_mileageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_loaderLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(20);
    }];
    
    UIView *splitorView2 = [[UIView alloc] init];
    splitorView2.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:splitorView2];
    [splitorView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.mas_equalTo(_qh_mileageLabel).with.offset(10);
        make.left.and.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(1);
    }];
    
    _qh_handleButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_handleButton.layer.cornerRadius = 5.0f;
    _qh_handleButton.layer.masksToBounds = YES;
    _qh_handleButton.titleLabel.font = kSmallerFont;
    _qh_handleButton.backgroundColor = kAppGreenColor;
    [_qh_handleButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_handleButton addTarget:self action:@selector(acceptContractOrNot:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_handleButton];
    [_qh_handleButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView2.mas_bottom).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(90);
        make.height.mas_equalTo(30);
    }];
    
    _qh_dialButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_dialButton.layer.cornerRadius = 5.0f;
    _qh_dialButton.layer.masksToBounds = YES;
    _qh_dialButton.titleLabel.font = kSmallerFont;
    _qh_dialButton.backgroundColor = kAppOrangeColor;
    [_qh_dialButton setTitle:@"联系货主" forState:UIControlStateNormal];
    [_qh_dialButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_dialButton addTarget:self action:@selector(dialMobile:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_dialButton];
    [_qh_dialButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView2.mas_bottom).with.offset(10);
        make.right.mas_equalTo(_qh_handleButton.mas_left).with.inset(5);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(30);
    }];
    
    _qh_canclePrince = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_canclePrince.layer.cornerRadius = 5.0f;
    _qh_canclePrince.layer.masksToBounds = YES;
    _qh_canclePrince.titleLabel.font = kSmallerFont;
    _qh_canclePrince.backgroundColor = kAppOrangeColor;
    [_qh_canclePrince setTitle:@"取消报价" forState:UIControlStateNormal];
    [_qh_canclePrince setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_canclePrince addTarget:self action:@selector(canclePrinceAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_canclePrince];
    [_qh_canclePrince mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView2.mas_bottom).with.offset(10);
        make.right.mas_equalTo(_qh_dialButton.mas_left).with.inset(5);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(30);
    }];
    
    _qh_showStatus = [[UILabel alloc] init];
    _qh_showStatus.font= [UIFont qh_fontSmaller];
//    _qh_mileageLabel.textColor = kDarkGrayColor;
//    _qh_mileageLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_showStatus];
    [_qh_showStatus mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView2.mas_bottom).with.offset(10);
        make.right.mas_equalTo(_qh_canclePrince.mas_left).with.offset(-5);
        make.left.mas_equalTo(self.contentView).with.inset(5);
        make.height.mas_equalTo(30);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.bottom.and.right.mas_equalTo(self.contentView);
        make.height.mas_equalTo(5);
    }];
}

- (void)canclePrinceAction:(UIButton *)sender
{
    DLog(@"取消报价");
    if ([_qh_delegate respondsToSelector:@selector(qh_canclePrince:)]) {
        
        [_qh_delegate qh_canclePrince:sender];
    }
}

- (IBAction)acceptContractOrNot:(UIButton *)sender {
    
    //查看协议/重新报价
    if ([_qh_delegate respondsToSelector:@selector(qh_acceptContractOrNot:)]) {
        
        [_qh_delegate qh_acceptContractOrNot:sender];
    }
}

- (IBAction)dialMobile:(UIButton *)sender {
    DLog(@"联系货主");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_dialMobile:)]) {
        
        [_qh_delegate qh_dialMobile:sender];
    }
}

@end


/// 智运客服Cell
@implementation GQHCustomerServiceCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_iconImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_qh_iconImageView];
    [_qh_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(self.contentView).with.inset(10);
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.width.mas_equalTo(_qh_iconImageView.mas_height).with.multipliedBy(1.0);
    }];
    
    _qh_titleLabel = [[UILabel alloc] init];
    _qh_titleLabel.font = kBiggerFont;
    _qh_titleLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_titleLabel];
    [_qh_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_iconImageView);
        make.left.mas_equalTo(_qh_iconImageView.mas_right).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(_qh_iconImageView.mas_height).with.multipliedBy(0.4);
    }];
    
    _qh_codeLabel = [[UILabel alloc] init];
    _qh_codeLabel.font = kSmallerFont;
    _qh_codeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_codeLabel];
    [_qh_codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_titleLabel.mas_bottom);
        make.left.mas_equalTo(_qh_iconImageView.mas_right).with.offset(10);
        make.right.mas_equalTo(_qh_titleLabel);
        make.height.mas_equalTo(_qh_iconImageView.mas_height).with.multipliedBy(0.3);
    }];
    
    UILabel *contentLabel = [[UILabel alloc] init];
    contentLabel.font = kSmallerFont;
    contentLabel.text = @"法定工作日 08:00 - 18:00";
    contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_codeLabel.mas_bottom);
        make.left.mas_equalTo(_qh_iconImageView.mas_right).with.offset(10);
        make.right.mas_equalTo(_qh_titleLabel);
        make.height.mas_equalTo(_qh_iconImageView.mas_height).with.multipliedBy(0.3);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.inset(singleMargin);
        make.right.and.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

@end


/// 发布货源选择熟车Cell
@implementation GQHFollowedTrucksCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_avatarImageView = [[UIImageView alloc] init];
    _qh_avatarImageView.layer.cornerRadius = 5.0f;
    _qh_avatarImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_qh_avatarImageView];
    [_qh_avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(self.contentView).with.inset(10);
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.width.mas_equalTo(_qh_avatarImageView.mas_height).with.multipliedBy(1.0);
    }];
    
    _qh_selectedButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_qh_selectedButton setBackgroundImage:nil forState:UIControlStateNormal];
    [_qh_selectedButton setBackgroundImage:nil forState:UIControlStateSelected];
    [self.contentView addSubview:_qh_selectedButton];
    [_qh_selectedButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.size.mas_equalTo(CGSizeMake(20, 20));
        make.centerY.mas_equalTo(self.mas_centerY);
    }];
    
    _qh_nameLabel = [[UILabel alloc] init];
    _qh_nameLabel.font = kDefaultFont;
    _qh_nameLabel.textColor = kDarkBlackColor;
    _qh_nameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_nameLabel];
    [_qh_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_avatarImageView);
        make.left.mas_equalTo(_qh_avatarImageView.mas_right).with.offset(10);
        make.right.mas_equalTo(_qh_selectedButton.mas_left).with.inset(10);
        make.height.mas_equalTo(_qh_avatarImageView).with.multipliedBy(0.34);
    }];
    
    _qh_subtitleLabel = [[UILabel alloc] init];
    _qh_subtitleLabel.font = kSmallerFont;
    _qh_subtitleLabel.textColor = kDarkGrayColor;
    _qh_subtitleLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_subtitleLabel];
    [_qh_subtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_nameLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_nameLabel);
        make.height.mas_equalTo(_qh_avatarImageView).with.multipliedBy(0.33);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_subtitleLabel.mas_bottom);
        make.left.and.right.and.height.mas_equalTo(_qh_subtitleLabel);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.offset(GQH_MARGIN_SINGLE);
        make.right.mas_equalTo(self).with.inset(GQH_MARGIN_SINGLE);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

@end


/// 找货Cell
@implementation GQHFreightsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_routeLabel = [[UILabel alloc] init];
    _qh_routeLabel.font = [UIFont boldSystemFontOfSize:15];
    _qh_routeLabel.textColor = kDarkBlackColor;
    _qh_routeLabel.textAlignment = NSTextAlignmentLeft;
    _qh_routeLabel.numberOfLines = 0;
    [self.contentView addSubview:_qh_routeLabel];
    [_qh_routeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView);
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(self.contentView.mas_height).with.multipliedBy(0.28);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_routeLabel.mas_bottom);
        make.left.mas_equalTo(_qh_routeLabel);
        make.right.mas_equalTo(self.contentView).with.inset(80);
        make.height.mas_equalTo(self.contentView.mas_height).with.multipliedBy(0.18);
    }];
    
    _qh_loadingTimeLabel = [[UILabel alloc] init];
    _qh_loadingTimeLabel.font = kSmallerFont;
    _qh_loadingTimeLabel.textColor = kDarkGrayColor;
    _qh_loadingTimeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_loadingTimeLabel];
    [_qh_loadingTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.left.mas_equalTo(_qh_contentLabel);
        make.right.mas_equalTo(_qh_contentLabel);
        make.height.mas_equalTo(_qh_contentLabel);
    }];
    
    _qh_loaderLabel = [[UILabel alloc] init];
    _qh_loaderLabel.font = kSmallerFont;
    _qh_loaderLabel.textColor = kDarkGrayColor;
    _qh_loaderLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_loaderLabel];
    [_qh_loaderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_loadingTimeLabel.mas_bottom);
        make.left.mas_equalTo(_qh_loadingTimeLabel);
        make.right.mas_equalTo(_qh_loadingTimeLabel);
        make.height.mas_equalTo(_qh_loadingTimeLabel);
    }];
    
    _qh_mileageLabel = [[UILabel alloc] init];
    _qh_mileageLabel.font = kSmallerFont;
    _qh_mileageLabel.textColor = kDarkGrayColor;
    _qh_mileageLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_mileageLabel];
    [_qh_mileageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_loaderLabel.mas_bottom);
        make.left.mas_equalTo(_qh_loaderLabel);
        make.right.mas_equalTo(self.contentView).with.inset(100);
        make.height.mas_equalTo(_qh_loaderLabel);
    }];
    
    _qh_postTimeLabel = [[UILabel alloc] init];
    _qh_postTimeLabel.font = kSmallerFont;
    _qh_postTimeLabel.textColor = kDarkGrayColor;
    _qh_postTimeLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_qh_postTimeLabel];
    [_qh_postTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_mileageLabel);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(_qh_mileageLabel);
    }];
    
    _qh_dialButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_qh_dialButton setImage:[UIImage imageNamed:@"basic_dialing"] forState:UIControlStateNormal];
    [_qh_dialButton setImageEdgeInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
    [_qh_dialButton addTarget:self action:@selector(dial:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_dialButton];
    [_qh_dialButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(self.contentView);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.size.mas_equalTo(CGSizeMake(50, 50));
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.offset(singleMargin);
        make.right.mas_equalTo(self).with.inset(singleMargin);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

- (IBAction)dial:(UIButton *)sender {
    DLog(@"拨打电话");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_dialMobile:)]) {
        
        [_qh_delegate qh_dialMobile:sender];
    }
}

@end




/// 关注页面列表Cell
@interface GQHFollowedCell () {
    
    UILabel *followedLabel;
    UIImageView *followedImageView;
}

@end

@implementation GQHFollowedCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    /// 头像
    _qh_avatarImageView = [[UIImageView alloc] init];
    _qh_avatarImageView.backgroundColor = kAppRedColor;
    _qh_avatarImageView.layer.cornerRadius = 2.0f;
    _qh_avatarImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_qh_avatarImageView];
    [_qh_avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.top.and.bottom.mas_equalTo(self.contentView).with.inset(10);
        make.width.mas_equalTo(_qh_avatarImageView.mas_height).with.multipliedBy(1.0);
    }];
    
    /// 关注或取消关注按钮
    _qh_followedButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_qh_followedButton addTarget:self action:@selector(followedOrUnfollowed:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_followedButton];
    [_qh_followedButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(self.contentView);
        make.right.mas_equalTo(self.contentView);
        make.width.mas_equalTo(_qh_followedButton.mas_height).with.multipliedBy(1.0);
    }];
    
    followedLabel = [[UILabel alloc] init];
    followedLabel.font = kSmallerFont;
    followedLabel.textAlignment = NSTextAlignmentCenter;
    [_qh_followedButton addSubview:followedLabel];
    [followedLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(_qh_followedButton);
        make.bottom.mas_equalTo(_qh_followedButton);
        make.height.mas_equalTo(_qh_followedButton).with.multipliedBy(0.4);
    }];
    
    followedImageView = [[UIImageView alloc] init];
    [_qh_followedButton addSubview:followedImageView];
    [followedImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.width.and.height.mas_equalTo(_qh_followedButton.mas_width).with.multipliedBy(0.4);
        make.bottom.mas_equalTo(followedLabel.mas_top);
        make.centerX.mas_equalTo(_qh_followedButton);
    }];
    
    UIView *splitorView = [[UIView alloc] init];
    splitorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:splitorView];
    [splitorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(_qh_followedButton).with.inset(singleMargin);
        make.right.mas_equalTo(_qh_followedButton.mas_left);
        make.width.mas_equalTo(2);
    }];
    
    /// 姓名
    _qh_nameLabel = [[UILabel alloc] init];
    _qh_nameLabel.font = kDefaultFont;
    _qh_nameLabel.textColor = kDarkBlackColor;
    _qh_nameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_nameLabel];
    [_qh_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_avatarImageView);
        make.left.mas_equalTo(_qh_avatarImageView.mas_right).with.offset(10);
        make.right.mas_equalTo(splitorView.mas_left);
        make.height.mas_equalTo(_qh_avatarImageView).with.multipliedBy(0.4);
    }];
    
    /// 评分(其他角色) ／ 车牌号(司机)
    _qh_subtitleLabel = [[UILabel alloc] init];
    _qh_subtitleLabel.font = kSmallerFont;
    _qh_subtitleLabel.textColor = kDarkGrayColor;
    _qh_subtitleLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_subtitleLabel];
    [_qh_subtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_nameLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_nameLabel);
        make.height.mas_equalTo(_qh_avatarImageView).with.multipliedBy(0.3);
    }];
    
    /// 机构名称(其他角色) ／ 车辆信息(司机)
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_subtitleLabel.mas_bottom);
        make.left.and.right.and.height.mas_equalTo(_qh_subtitleLabel);
    }];
    
    /// 分割线
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.offset(singleMargin);
        make.right.mas_equalTo(self).with.inset(singleMargin);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

- (void)setQh_followed:(BOOL)qh_followed {
    
    if (qh_followed) {
        
        followedLabel.text = @"取消关注";
        followedLabel.textColor = kGrayColor;
        followedImageView.image = [UIImage imageNamed:@"unfollow"];
    } else {
        
        followedLabel.text = @"关注";
        followedLabel.textColor = kAppGreenColor;
        followedImageView.image = [UIImage imageNamed:@"follow"];
    }
}

- (IBAction)followedOrUnfollowed:(UIButton *)sender {
    DLog(@"关注或取消关注");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_followedOrUnfollowed:)]) {
        
        [_qh_delegate qh_followedOrUnfollowed:sender];
    }
}

@end





/// 转账记录页面Cell
@implementation GQHTransactionCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_titleLabel = [[UILabel alloc] init];
    _qh_titleLabel.font = kDefaultFont;
    _qh_titleLabel.textColor = kDarkBlackColor;
    _qh_titleLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_titleLabel];
    [_qh_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).with.offset(10);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(self.contentView.mas_centerX);
        make.height.mas_equalTo(30);
    }];
    
    _qh_timeLabel = [[UILabel alloc] init];
    _qh_timeLabel.font = kSmallerFont;
    _qh_timeLabel.textColor = kDarkBlackColor;
    _qh_timeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_timeLabel];
    [_qh_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_titleLabel.mas_bottom);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(self.contentView.mas_centerX);
        make.height.mas_equalTo(20);
    }];
    
    _qh_amountLabel = [[UILabel alloc] init];
    _qh_amountLabel.font = kDefaultFont;
    _qh_amountLabel.textColor = kAppGreenColor;
    _qh_amountLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_qh_amountLabel];
    [_qh_amountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).with.offset(10);
        make.left.mas_equalTo(self.contentView.mas_centerX);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    _qh_statusLabel = [[UILabel alloc] init];
    _qh_statusLabel.font = kSmallerFont;
    _qh_statusLabel.textColor = kAppPinkColor;
    _qh_statusLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_qh_statusLabel];
    [_qh_statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_amountLabel.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.left.mas_equalTo(self.contentView.mas_centerX);
        make.height.mas_equalTo(20);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.offset(singleMargin);
        make.right.mas_equalTo(self).with.inset(singleMargin);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

@end


// 转入银行页面Cell
@implementation GQHTransactionInBankCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_imageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_qh_imageView];
    [_qh_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(GQH_MARGIN_SINGLE);
        make.centerY.mas_equalTo(self.contentView);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(60);
    }];
    
    _qh_captionLabel = [[UILabel alloc] init];
    _qh_captionLabel.font = kBiggerFont;
    _qh_captionLabel.textColor = kDarkBlackColor;
    _qh_captionLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_captionLabel];
    [_qh_captionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(_qh_imageView.mas_right).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
        make.top.mas_equalTo(_qh_imageView);
        make.height.mas_equalTo(30);
    }];
    
    _qh_detailLabel = [[UILabel alloc] init];
    _qh_detailLabel.font = kBiggerFont;
    _qh_detailLabel.textColor = kDarkBlackColor;
    _qh_detailLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_detailLabel];
    [_qh_detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.and.height.mas_equalTo(_qh_captionLabel);
        make.top.mas_equalTo(_qh_captionLabel.mas_bottom);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).with.offset(GQH_MARGIN_SINGLE);
        make.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
        make.bottom.mas_equalTo(self.contentView);
        make.height.mas_equalTo(1);
    }];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end




// 车辆信息页面图文Cell
@implementation GQHTruckImagesCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_rightImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_qh_rightImageView];
    [_qh_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
//        make.size.mas_equalTo(CGSizeMake(75, 50));
        
        make.top.and.bottom.mas_equalTo(self.contentView).with.inset(10);
        make.width.mas_equalTo(_qh_rightImageView.mas_height).with.multipliedBy(1.5);
        
        
        
//        make.centerY.mas_equalTo(self.contentView);
        make.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
    }];
    
    _qh_leftImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_qh_leftImageView];
    [_qh_leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.size.mas_equalTo(_qh_rightImageView);
        make.centerY.mas_equalTo(self.contentView);
        make.right.mas_equalTo(_qh_rightImageView.mas_left).with.inset(5);
    }];
    
    _qh_captionLabel = [[UILabel alloc] init];
    _qh_captionLabel.font = kDefaultFont;
    _qh_captionLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_captionLabel];
    [_qh_captionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(GQH_MARGIN_SINGLE);
        make.centerY.mas_equalTo(self.contentView);
        make.right.mas_equalTo(_qh_leftImageView.mas_left);
        make.height.mas_equalTo(30);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.offset(GQH_MARGIN_SINGLE);
        make.right.mas_equalTo(self).with.inset(GQH_MARGIN_SINGLE);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

@end


// 角色选择页面Cell
@implementation GQHRoleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = kLightGrayColor;
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    UIView *containerView = [[UIView alloc] init];
    containerView.layer.cornerRadius = 5.0;
    containerView.layer.masksToBounds = YES;
    containerView.backgroundColor = kWhiteColor;
    [self.contentView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.left.and.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
        make.bottom.mas_equalTo(self.contentView);
    }];
    
    _qh_imageView = [[UIImageView alloc] init];
    [containerView addSubview:_qh_imageView];
    [_qh_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.left.and.bottom.mas_equalTo(containerView).with.inset(10);
        make.width.equalTo(_qh_imageView.mas_height).with.multipliedBy(1.0);
    }];
    
    _qh_titleLabel = [[UILabel alloc] init];
    _qh_titleLabel.font = kBiggerFont;
    _qh_titleLabel.textColor = kBlackColor;
    _qh_titleLabel.textAlignment = NSTextAlignmentLeft;
    [containerView addSubview:_qh_titleLabel];
    [_qh_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_imageView);
        make.left.mas_equalTo(_qh_imageView.mas_right).with.offset(10);
        make.height.mas_equalTo(25);
        make.right.mas_equalTo(containerView);
    }];
    
    _qh_descriptionLabel = [[UILabel alloc] init];
    _qh_descriptionLabel.font = kSmallerFont;
    _qh_descriptionLabel.textColor = kDarkGrayColor;
    _qh_descriptionLabel.textAlignment = NSTextAlignmentLeft;
    _qh_descriptionLabel.numberOfLines = 0;
    [containerView addSubview:_qh_descriptionLabel];
    [_qh_descriptionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(_qh_titleLabel);
        make.top.mas_equalTo(_qh_titleLabel.mas_bottom);
        make.bottom.mas_equalTo(_qh_imageView);
    }];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end





/// 我的评价-查看评价Cell

#import "QHRatingView.h"
@interface GQHReviewCell ()

@end


@implementation GQHReviewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_avatarImageView = [[UIImageView alloc] init];
    _qh_avatarImageView.layer.cornerRadius = 5;
    _qh_avatarImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_qh_avatarImageView];
    [_qh_avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).with.offset(10);
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.size.mas_equalTo(CGSizeMake(40.0, 40.0));
    }];
    
    _qh_timeLabel = [[UILabel alloc] init];
    _qh_timeLabel.font = kSmallerFont;
    _qh_timeLabel.textColor = kDarkGrayColor;
    _qh_timeLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_qh_timeLabel];
    [_qh_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_avatarImageView);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    _qh_nameLabel = [[UILabel alloc] init];
    _qh_nameLabel.font = kDefaultFont;
    _qh_nameLabel.textColor = kDarkBlackColor;
    _qh_nameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_nameLabel];
    [_qh_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_avatarImageView);
        make.left.mas_equalTo(_qh_avatarImageView.mas_right).with.offset(10);
        make.right.mas_equalTo(_qh_timeLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    _qh_ratingView = [[UIView alloc] init];
    _qh_ratingView.backgroundColor = kWhiteColor;
    [self.contentView addSubview:_qh_ratingView];
    [_qh_ratingView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_nameLabel.mas_bottom);
        make.left.mas_equalTo(_qh_nameLabel);
        make.size.mas_equalTo(CGSizeMake(100, 20));
    }];
    
    _qh_scoreLabel = [[UILabel alloc] init];
    _qh_scoreLabel.backgroundColor = kClearColor;
    _qh_scoreLabel.font = kSmallerFont;
    _qh_scoreLabel.textColor = kDarkGrayColor;
    _qh_scoreLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_scoreLabel];
    [_qh_scoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.and.bottom.mas_equalTo(_qh_ratingView);
        make.left.mas_equalTo(_qh_ratingView.mas_right).with.offset(10);
        make.right.mas_equalTo(self.contentView.mas_right).with.inset(singleMargin);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kDefaultFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    _qh_contentLabel.numberOfLines = 0;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_avatarImageView.mas_bottom).with.offset(10);
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_greaterThanOrEqualTo(50);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.offset(singleMargin);
        make.right.mas_equalTo(self).with.offset(singleMargin);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

@end






// 我关注的货主-货主信息-他的货源Cell
@implementation GQHFreightCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    
    return self;
}

- (void)loadUserInterface {
    
    UIView *referenceView = [[UIView alloc] init];
    referenceView.backgroundColor = kClearColor;
    [self.contentView addSubview:referenceView];
    [referenceView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(self.contentView);
        make.left.mas_equalTo(self.contentView);
        make.width.mas_equalTo(0);
    }];
    
    _qh_routeLabel = [[UILabel alloc] init];
    _qh_routeLabel.textColor = kDarkBlackColor;
    _qh_routeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_routeLabel];
    [_qh_routeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).with.offset(GQH_MARGIN_SINGLE);
        make.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
        make.top.mas_equalTo(self.contentView);
        make.height.mas_equalTo(referenceView).with.multipliedBy(0.4);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_routeLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(referenceView).with.multipliedBy(0.3);
    }];
    
    _qh_timeLabel = [[UILabel alloc] init];
    _qh_timeLabel.font = kSmallerFont;
    _qh_timeLabel.textColor = kDarkGrayColor;
    _qh_timeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_timeLabel];
    [_qh_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.left.and.right.and.height.mas_equalTo(_qh_contentLabel);
    }];
    
    _qh_pushButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_pushButton.layer.borderColor = kAppGreenColor.CGColor;
    _qh_pushButton.layer.borderWidth = 0.5;
    _qh_pushButton.layer.cornerRadius = 5.0;
    _qh_pushButton.layer.masksToBounds = YES;
    _qh_pushButton.titleLabel.font = kDefaultFont;
    _qh_pushButton.backgroundColor = kAppGreenColor;
    [_qh_pushButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_pushButton addTarget:self action:@selector(pushFreight:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_pushButton];
    [_qh_pushButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.size.mas_equalTo(CGSizeMake(80, 30));
        make.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
        make.centerY.mas_equalTo(self.contentView);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.offset(20);
        make.right.mas_equalTo(self).with.inset(20);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

- (IBAction)pushFreight:(UIButton *)sender {
    DLog(@"推送货源");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_pushFreight:)]) {
        
        [_qh_delegate qh_pushFreight:sender];
    }
}

@end



// 我关注的车辆-车辆信息-路线Cell
@implementation GQHRouteCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    UIImageView *toImageView = [[UIImageView alloc] init];
    toImageView.image = [UIImage imageNamed:@"me_from_to"];
    [self.contentView addSubview:toImageView];
    [toImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.center.mas_equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(20, 20));
    }];
    
    _qh_departureLabel = [[UILabel alloc] init];
    _qh_departureLabel.font = kDefaultFont;
    _qh_departureLabel.text = @"陕西 延安 洛川县";
    _qh_departureLabel.textColor = kDarkBlackColor;
    _qh_departureLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_departureLabel];
    [_qh_departureLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(self.contentView);
        make.left.mas_equalTo(self.contentView).with.offset(GQH_MARGIN_SINGLE);
        make.right.mas_equalTo(toImageView.mas_left);
    }];
    
    _qh_destinationLabel = [[UILabel alloc] init];
    _qh_destinationLabel.font = kDefaultFont;
    _qh_destinationLabel.text = @"陕西 西安 雁塔区";
    _qh_destinationLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_qh_destinationLabel];
    [_qh_destinationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(self.contentView);
        make.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
        make.left.mas_equalTo(toImageView.mas_right);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).with.offset(GQH_MARGIN_SINGLE);
        make.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

@end






/// 找车列表Cell
@implementation GQHTrucksCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_avatarImageView = [[UIImageView alloc] init];
    _qh_avatarImageView.layer.cornerRadius = 2.0f;
    _qh_avatarImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_qh_avatarImageView];
    [_qh_avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.mas_equalTo(self.contentView).with.inset(10);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(_qh_avatarImageView.mas_height).with.multipliedBy(1.0);
    }];
    
    _qh_dialButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_qh_dialButton setImageEdgeInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
    [_qh_dialButton setImage:[UIImage imageNamed:@"basic_dialing"] forState:UIControlStateNormal];
    [_qh_dialButton addTarget:self action:@selector(dialMobile:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_qh_dialButton];
    [_qh_dialButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.size.mas_equalTo(CGSizeMake(30, 30));
        make.centerY.mas_equalTo(self.contentView);
    }];
    
    _qh_nameLabel = [[UILabel alloc] init];
    _qh_nameLabel.font = kDefaultFont;
    _qh_nameLabel.textColor = kDarkBlackColor;
    _qh_nameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_nameLabel];
    [_qh_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_avatarImageView);
        make.left.mas_equalTo(_qh_avatarImageView.mas_right).with.offset(10);
        make.right.mas_equalTo(_qh_dialButton.mas_left);
        make.height.mas_equalTo(_qh_avatarImageView).with.multipliedBy(0.4);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_nameLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_nameLabel);
        make.height.mas_equalTo(_qh_avatarImageView).with.multipliedBy(0.3);
    }];
    
    _qh_routeLabel = [[UILabel alloc] init];
    _qh_routeLabel.font = kSmallerFont;
    _qh_routeLabel.textColor = kDarkGrayColor;
    _qh_routeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_routeLabel];
    [_qh_routeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_contentLabel);
        make.height.mas_equalTo(_qh_avatarImageView).with.multipliedBy(0.3);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self).with.inset(singleMargin);
        make.right.mas_equalTo(self).with.inset(singleMargin);
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

- (IBAction)dialMobile:(UIButton *)sender {
    DLog(@"拨打电话");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_dialMobile:)]) {
        
        [_qh_delegate qh_dialMobile:sender];
    }
}

@end





///  我的运单列表Cell
@implementation GQHOrderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_statusLabel = [[UILabel alloc] init];
    _qh_statusLabel.font = kDefaultFont;
    _qh_statusLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_qh_statusLabel];
    [_qh_statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.size.mas_equalTo(CGSizeMake(80, 20));
    }];
    
    _qh_orderIDLabel = [[UILabel alloc] init];
    _qh_orderIDLabel.font = kDefaultFont;
    _qh_orderIDLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_orderIDLabel];
    [_qh_orderIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).with.offset(10);
        make.left.mas_equalTo(self.contentView).with.offset(singleMargin);
        make.right.mas_equalTo(_qh_statusLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    UIView *containerView = [[UIView alloc] init];
    containerView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(self.contentView);
        make.top.mas_equalTo(_qh_orderIDLabel.mas_bottom).with.offset(10);
        make.height.mas_equalTo(90);
    }];
    
    _qh_routeLabel = [[UILabel alloc] init];
    _qh_routeLabel.font = kDefaultFont;
    _qh_routeLabel.textAlignment = NSTextAlignmentLeft;
    [containerView addSubview:_qh_routeLabel];
    [_qh_routeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(containerView).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(30);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font= kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [containerView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_routeLabel.mas_bottom);
        make.left.and.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(20);
    }];
    
    _qh_nameLabel = [[UILabel alloc] init];
    _qh_nameLabel.font= kSmallerFont;
    _qh_nameLabel.textColor = kDarkGrayColor;
    _qh_nameLabel.textAlignment = NSTextAlignmentLeft;
    [containerView addSubview:_qh_nameLabel];
    [_qh_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.left.and.right.and.height.mas_equalTo(_qh_contentLabel);
    }];
    
    /// 按钮布局是反序布局
    /// 第四个按钮
    _qh_fourView = [[UIView alloc] init];
    _qh_fourButton.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:_qh_fourView];
    [_qh_fourView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(containerView.mas_bottom).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];
    
    _qh_fourButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_fourButton.titleLabel.font = kSmallerFont;
    _qh_fourButton.layer.cornerRadius = 5.0f;
    _qh_fourButton.backgroundColor = kAppGreenColor;
    [_qh_fourButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_fourButton addTarget:self action:@selector(loadedOrUnloadedOrComment:) forControlEvents:UIControlEventTouchUpInside];
    [_qh_fourView addSubview:_qh_fourButton];
    [_qh_fourButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.right.mas_equalTo(_qh_fourView);
        make.left.mas_equalTo(_qh_fourView).with.inset(10);
    }];
    
    /// 第三个按钮
    _qh_threeView = [[UIView alloc] init];
    _qh_threeView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:_qh_threeView];
    [_qh_threeView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(containerView.mas_bottom).with.offset(10);
        make.right.mas_equalTo(_qh_fourView.mas_left);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];
    
    _qh_threeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_threeButton.titleLabel.font = kSmallerFont;
    _qh_threeButton.layer.cornerRadius = 5.0f;
    _qh_threeButton.backgroundColor = kAppGreenColor;
    [_qh_threeButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_threeButton addTarget:self action:@selector(cancelOrMap:) forControlEvents:UIControlEventTouchUpInside];
    [_qh_threeView addSubview:_qh_threeButton];
    [_qh_threeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.right.mas_equalTo(_qh_threeView);
        make.left.mas_equalTo(_qh_threeView).with.inset(10);
    }];
    
    /// 第二个按钮
    _qh_twoView = [[UIView alloc] init];
    _qh_twoView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:_qh_twoView];
    [_qh_twoView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(containerView.mas_bottom).with.offset(10);
        make.right.mas_equalTo(_qh_threeView.mas_left);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];
    
    _qh_twoButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_twoButton.titleLabel.font = kSmallerFont;
    _qh_twoButton.layer.cornerRadius = 5.0f;
    _qh_twoButton.backgroundColor = kAppOrangeColor;
    [_qh_twoButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_twoButton addTarget:self action:@selector(dialMobile:) forControlEvents:UIControlEventTouchUpInside];
    [_qh_twoView addSubview:_qh_twoButton];
    [_qh_twoButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.right.mas_equalTo(_qh_twoView);
        make.left.mas_equalTo(_qh_twoView).with.inset(10);
    }];
    
    /// 第一个按钮
    _qh_oneView = [[UIView alloc] init];
    _qh_oneView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:_qh_oneView];
    [_qh_oneView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(containerView.mas_bottom).with.offset(10);
        make.right.mas_equalTo(_qh_twoView.mas_left);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];
    
    _qh_oneButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _qh_oneButton.titleLabel.font = kSmallerFont;
    _qh_oneButton.layer.cornerRadius = 5.0f;
    _qh_oneButton.backgroundColor = kAppOrangeColor;
    [_qh_oneButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [_qh_oneButton addTarget:self action:@selector(checkContract:) forControlEvents:UIControlEventTouchUpInside];
    [_qh_oneView addSubview:_qh_oneButton];
    [_qh_oneButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.bottom.right.mas_equalTo(_qh_oneView);
        make.left.mas_equalTo(_qh_oneView).with.inset(10);
    }];
    
    UIView *separatorView = [[UIView alloc] init];
    separatorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:separatorView];
    [separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.bottom.right.mas_equalTo(self);
        make.height.mas_equalTo(5);
    }];
}

- (IBAction)loadedOrUnloadedOrComment:(UIButton *)sender {
    DLog(@"确认装车或确认送达或评价");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_loadedOrUnloadedOrComment:)]) {
        
        [_qh_delegate qh_loadedOrUnloadedOrComment:sender];
    }
}

- (IBAction)cancelOrMap:(UIButton *)sender {
    DLog(@"取消订单或在途追踪");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_cancelOrMap:)]) {
        
        [_qh_delegate qh_cancelOrMap:sender];
    }
}

- (IBAction)checkContract:(UIButton *)sender {
    DLog(@"查看协议内容");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_checkContract:)]) {
        
        [_qh_delegate qh_checkContract:sender];
    }
}

- (IBAction)dialMobile:(UIButton *)sender {
    DLog(@"拨打电话");
    
    if ([_qh_delegate respondsToSelector:@selector(qh_dialMobile:)]) {
        
        [_qh_delegate qh_dialMobile:sender];
    }
}

@end


// 协议内容页面Cell
@interface GQHContractCell () <UIWebViewDelegate>
@end

@implementation GQHContractCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_totalFeeLabel = [[UILabel alloc] init];
    _qh_totalFeeLabel.font = kDefaultFont;
    _qh_totalFeeLabel.textColor = kDarkBlackColor;
    _qh_totalFeeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_totalFeeLabel];
    [_qh_totalFeeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.and.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    _qh_contractTimeLabel = [[UILabel alloc] init];
    _qh_contractTimeLabel.font = kDefaultFont;
    _qh_contractTimeLabel.textColor = kDarkBlackColor;
    _qh_contractTimeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contractTimeLabel];
    [_qh_contractTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.and.height.mas_equalTo(_qh_totalFeeLabel);
        make.top.mas_equalTo(_qh_totalFeeLabel.mas_bottom).with.inset(10);
    }];
    
    UIView *sectionView1 = [[UIView alloc] init];
    sectionView1.backgroundColor = kLightGrayColor;
    [self addSubview:sectionView1];
    [sectionView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contractTimeLabel.mas_bottom).with.offset(singleMargin);
        make.left.and.right.mas_equalTo(self);
        make.height.mas_equalTo(40);
    }];
    
    UILabel *shipperLabel = [[UILabel alloc] init];
    shipperLabel.font = kDefaultFont;
    shipperLabel.text = @"托运信息";
    shipperLabel.textColor = kDarkBlackColor;
    shipperLabel.textAlignment = NSTextAlignmentLeft;
    [sectionView1 addSubview:shipperLabel];
    [shipperLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(sectionView1).with.inset(GQH_MARGIN_SINGLE);
        make.top.and.bottom.mas_equalTo(sectionView1).with.inset(10);
    }];
    
    _qh_shipperAvatarImageView = [[UIImageView alloc] init];
    _qh_shipperAvatarImageView.layer.cornerRadius = 5;
    _qh_shipperAvatarImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_qh_shipperAvatarImageView];
    [_qh_shipperAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(sectionView1.mas_bottom).with.offset(singleMargin);
        make.left.mas_equalTo(shipperLabel);
        make.size.mas_equalTo(CGSizeMake(60.0, 60.0));
    }];
    
    _qh_shipperNameLabel = [[UILabel alloc] init];
    _qh_shipperNameLabel.font = kDefaultFont;
    _qh_shipperNameLabel.textColor = kDarkBlackColor;
    _qh_shipperNameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_shipperNameLabel];
    [_qh_shipperNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(_qh_shipperAvatarImageView);
        make.top.mas_equalTo(_qh_shipperAvatarImageView.mas_bottom).with.inset(10);
        make.height.mas_equalTo(20);
    }];
    
    _qh_routeLabel = [[UILabel alloc] init];
    _qh_routeLabel.font = kDefaultFont;
    _qh_routeLabel.textColor = kDarkBlackColor;
    _qh_routeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_routeLabel];
    [_qh_routeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_shipperAvatarImageView);
        make.left.mas_equalTo(_qh_shipperAvatarImageView.mas_right).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(30);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kDefaultFont;
    _qh_contentLabel.textColor = kDarkBlackColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_routeLabel.mas_bottom);
        make.left.mas_equalTo(_qh_routeLabel);
        make.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(20);
    }];
    
    _qh_packTimeLabel = [[UILabel alloc] init];
    _qh_packTimeLabel.font = kDefaultFont;
    _qh_packTimeLabel.textColor = kDarkBlackColor;
    _qh_packTimeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_packTimeLabel];
    [_qh_packTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_contentLabel.mas_bottom);
        make.left.mas_equalTo(_qh_routeLabel);
        make.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(20);
    }];
    
    _qh_totalFeeLabel1 = [[UILabel alloc] init];
    _qh_totalFeeLabel1.font = kDefaultFont;
    _qh_totalFeeLabel1.textColor = kDarkBlackColor;
    _qh_totalFeeLabel1.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_totalFeeLabel1];
    [_qh_totalFeeLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_packTimeLabel.mas_bottom);
        make.left.mas_equalTo(_qh_routeLabel);
        make.right.mas_equalTo(_qh_routeLabel);
        make.height.mas_equalTo(20);
    }];
    
    UIView *splitorView1 = [[UIView alloc] init];
    splitorView1.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:splitorView1];
    [splitorView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_totalFeeLabel1.mas_bottom).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(2);
    }];
    
    UILabel * consigneeTitle = [[UILabel alloc] init];
    consigneeTitle.textAlignment = NSTextAlignmentRight;
    consigneeTitle.text = @"收货联系人：";
    consigneeTitle.font = kDefaultFont;
    consigneeTitle.textColor = kDarkBlackColor;
    consigneeTitle.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:consigneeTitle];
    [consigneeTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView1.mas_bottom).with.offset(10);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(self.contentView.mas_centerX);
        make.height.mas_equalTo(20);
    }];
    
    _driverName = [[UILabel alloc] init];
    _driverName.font = kDefaultFont;
    _driverName.textColor = kDarkBlackColor;
    _driverName.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_driverName];
    [_driverName mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView1.mas_bottom).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.left.mas_equalTo(self.contentView.mas_centerX);
        make.height.mas_equalTo(20);
    }];
    
    UILabel * consigneeMobileTitle = [[UILabel alloc] init];
    consigneeMobileTitle.textAlignment = NSTextAlignmentRight;
    consigneeMobileTitle.text = @"收货电话：";
    consigneeMobileTitle.font = kDefaultFont;
    consigneeMobileTitle.textColor = kDarkBlackColor;
    consigneeMobileTitle.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:consigneeMobileTitle];
    [consigneeMobileTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(consigneeTitle.mas_bottom);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(self.contentView.mas_centerX);
        make.height.mas_equalTo(20);
    }];
    
    _consigneeMobile = [[UILabel alloc] init];
    _consigneeMobile.font = kDefaultFont;
    _consigneeMobile.textColor = kDarkBlackColor;
    _consigneeMobile.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_consigneeMobile];
    [_consigneeMobile mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(consigneeTitle.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.left.mas_equalTo(self.contentView.mas_centerX);
        make.height.mas_equalTo(20);
    }];
    
    UILabel * ownerTitle = [[UILabel alloc] init];
    ownerTitle.text = @"装货联系人：";
    ownerTitle.font = kDefaultFont;
    ownerTitle.textColor = kDarkBlackColor;
    ownerTitle.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:ownerTitle];
    [ownerTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(consigneeMobileTitle.mas_bottom);
        make.right.mas_equalTo(self.contentView.mas_centerX);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    _ownerName = [[UILabel alloc] init];
    _ownerName.font = kDefaultFont;
    _ownerName.textColor = kDarkBlackColor;
    _ownerName.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_ownerName];
    [_ownerName mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(consigneeMobileTitle.mas_bottom);
        make.left.mas_equalTo(self.contentView.mas_centerX);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    UIView *splitorView = [[UIView alloc] init];
    splitorView.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:splitorView];
    [splitorView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_ownerName.mas_bottom).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(2);
    }];
    
    _qh_prepaidLabel = [[UILabel alloc] init];
    _qh_prepaidLabel.font = kDefaultFont;
    _qh_prepaidLabel.textColor = kDarkBlackColor;
    _qh_prepaidLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_prepaidLabel];
    [_qh_prepaidLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *preGasLabel = [[UILabel alloc] init];
    preGasLabel = [[UILabel alloc] init];
    preGasLabel.font = kDefaultFont;
    preGasLabel.text = @"线下支付";
    preGasLabel.textColor = kDarkBlackColor;
    preGasLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:preGasLabel];
    [preGasLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_prepaidLabel.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    _qh_preGasLabel = [[UILabel alloc] init];
    _qh_preGasLabel.font = kDefaultFont;
    _qh_preGasLabel.textColor = kDarkBlackColor;
    _qh_preGasLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_preGasLabel];
    [_qh_preGasLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_prepaidLabel.mas_bottom);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(preGasLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *preETCLabel = [[UILabel alloc] init];
    preETCLabel = [[UILabel alloc] init];
    preETCLabel.font = kDefaultFont;
    preETCLabel.text = @"线下支付";
    preETCLabel.textColor = kDarkBlackColor;
    preETCLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:preETCLabel];
    [preETCLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_preGasLabel.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    _qh_preETCLabel = [[UILabel alloc] init];
    _qh_preETCLabel.font = kDefaultFont;
    _qh_preETCLabel.textColor = kDarkBlackColor;
    _qh_preETCLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_preETCLabel];
    [_qh_preETCLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_preGasLabel.mas_bottom);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(preETCLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *preCashLabel = [[UILabel alloc] init];
    preCashLabel = [[UILabel alloc] init];
    preCashLabel.font = kDefaultFont;
    preCashLabel.text = @"线下支付";
    preCashLabel.textColor = kDarkBlackColor;
    preCashLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:preCashLabel];
    [preCashLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_preETCLabel.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    _qh_preCashLabel = [[UILabel alloc] init];
    _qh_preCashLabel.font = kDefaultFont;
    _qh_preCashLabel.textColor = kDarkBlackColor;
    _qh_preCashLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_preCashLabel];
    [_qh_preCashLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_preETCLabel.mas_bottom);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(preCashLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    UIView *splitorView2 = [[UIView alloc] init];
    splitorView2.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:splitorView2];
    [splitorView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_preCashLabel.mas_bottom).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(2);
    }];
    
    _qh_postpaidLabel = [[UILabel alloc] init];
    _qh_postpaidLabel.font = kDefaultFont;
    _qh_postpaidLabel.textColor = kDarkBlackColor;
    _qh_postpaidLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_postpaidLabel];
    [_qh_postpaidLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView2).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    
    UILabel *postGasLabel = [[UILabel alloc] init];
    postGasLabel = [[UILabel alloc] init];
    postGasLabel.font = kDefaultFont;
    postGasLabel.text = @"线下支付";
    postGasLabel.textColor = kDarkBlackColor;
    postGasLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:postGasLabel];
    [postGasLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_postpaidLabel.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    _qh_postGasLabel = [[UILabel alloc] init];
    _qh_postGasLabel.font = kDefaultFont;
    _qh_postGasLabel.textColor = kDarkBlackColor;
    _qh_postGasLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_postGasLabel];
    [_qh_postGasLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_postpaidLabel.mas_bottom);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(preCashLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *postETCLabel = [[UILabel alloc] init];
    postETCLabel = [[UILabel alloc] init];
    postETCLabel.font = kDefaultFont;
    postETCLabel.text = @"线下支付";
    postETCLabel.textColor = kDarkBlackColor;
    postETCLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:postETCLabel];
    [postETCLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_postGasLabel.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    _qh_postETCLabel = [[UILabel alloc] init];
    _qh_postETCLabel.font = kDefaultFont;
    _qh_postETCLabel.textColor = kDarkBlackColor;
    _qh_postETCLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_postETCLabel];
    [_qh_postETCLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_postGasLabel.mas_bottom);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(preCashLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *postCashLabel = [[UILabel alloc] init];
    postCashLabel = [[UILabel alloc] init];
    postCashLabel.font = kDefaultFont;
    postCashLabel.text = @"线下支付";
    postCashLabel.textColor = kDarkBlackColor;
    postCashLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:postCashLabel];
    [postCashLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_postETCLabel.mas_bottom);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    _qh_postCashLabel = [[UILabel alloc] init];
    _qh_postCashLabel.font = kDefaultFont;
    _qh_postCashLabel.textColor = kDarkBlackColor;
    _qh_postCashLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_postCashLabel];
    [_qh_postCashLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_postETCLabel.mas_bottom);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(preCashLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    UIView *splitorView3 = [[UIView alloc] init];
    splitorView3.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:splitorView3];
    [splitorView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_postCashLabel.mas_bottom).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(2);
    }];
    
    _qh_weightLabel = [[UILabel alloc] init];
    _qh_weightLabel.font = kDefaultFont;
    _qh_weightLabel.textColor = kDarkBlackColor;
    _qh_weightLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_weightLabel];
    [_qh_weightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView3).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    _qh_volumeLabel = [[UILabel alloc] init];
    _qh_volumeLabel.font = kDefaultFont;
    _qh_volumeLabel.textColor = kDarkBlackColor;
    _qh_volumeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_volumeLabel];
    [_qh_volumeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_weightLabel.mas_bottom);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    _qh_quantityLabel = [[UILabel alloc] init];
    _qh_quantityLabel.font = kDefaultFont;
    _qh_quantityLabel.textColor = kDarkBlackColor;
    _qh_quantityLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_quantityLabel];
    [_qh_quantityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_volumeLabel.mas_bottom);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    /*
    UIView *splitorView4 = [[UIView alloc] init];
    splitorView4.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:splitorView4];
    [splitorView4 mas_makeConstraints:^(MASConstraintMaker *make) {
     
        make.top.mas_equalTo(_qh_quantityLabel.mas_bottom).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(2);
    }];
    UILabel *otherFeeLabel = [[UILabel alloc] init];
    otherFeeLabel = [[UILabel alloc] init];
    otherFeeLabel.font = kDefaultFont;
    otherFeeLabel.text = @"线下支付";
    otherFeeLabel.textColor = kDarkBlackColor;
    otherFeeLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:otherFeeLabel];
    [otherFeeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(splitorView4.mas_bottom).with.offset(10);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    _qh_otherFeeLabel = [[UILabel alloc] init];
    _qh_otherFeeLabel.font = kDefaultFont;
    _qh_otherFeeLabel.textColor = kDarkBlackColor;
    _qh_otherFeeLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_otherFeeLabel];
    [_qh_otherFeeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(otherFeeLabel);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.right.mas_equalTo(otherFeeLabel.mas_left);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *noteLabel = [[UILabel alloc] init];
    noteLabel = [[UILabel alloc] init];
    noteLabel.font = kDefaultFont;
    noteLabel.text = @"其他费用说明：";
    noteLabel.textColor = kDarkBlackColor;
    noteLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:noteLabel];
    [noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_otherFeeLabel.mas_bottom).with.offset(10);
        make.left.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(20);
    }];
    
    _qh_noteLabel = [[UILabel alloc] init];
    _qh_noteLabel.font = kDefaultFont;
    _qh_noteLabel.text = @"货物多出来了2吨";
    _qh_noteLabel.textColor = kDarkBlackColor;
    _qh_noteLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_noteLabel];
    [_qh_noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(noteLabel.mas_bottom);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    */
    
    UIView *sectionView2 = [[UIView alloc] init];
    sectionView2.backgroundColor = kLightGrayColor;
    [self addSubview:sectionView2];
    [sectionView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_quantityLabel.mas_bottom).with.offset(singleMargin);
        make.left.and.right.mas_equalTo(self);
        make.height.mas_equalTo(40);
    }];
    
    UILabel *driverLabel = [[UILabel alloc] init];
    driverLabel.font = kDefaultFont;
    driverLabel.text = @"承运信息";
    driverLabel.textColor = kDarkBlackColor;
    driverLabel.textAlignment = NSTextAlignmentLeft;
    [sectionView2 addSubview:driverLabel];
    [driverLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(sectionView2).with.inset(singleMargin);
        make.top.and.bottom.mas_equalTo(sectionView2).with.inset(10);
    }];
    
    _qh_driverAvatarImageView = [[UIImageView alloc] init];
    _qh_driverAvatarImageView.image = nil;
    _qh_driverAvatarImageView.layer.cornerRadius = 5;
    _qh_driverAvatarImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_qh_driverAvatarImageView];
    [_qh_driverAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(sectionView2.mas_bottom).with.offset(singleMargin);
        make.left.mas_equalTo(driverLabel);
        make.size.mas_equalTo(CGSizeMake(60.0, 60.0));
    }];
    
    _qh_driverNameLabel = [[UILabel alloc] init];
    _qh_driverNameLabel.font = kDefaultFont;
    _qh_driverNameLabel.textColor = kDarkBlackColor;
    _qh_driverNameLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_driverNameLabel];
    [_qh_driverNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(_qh_driverAvatarImageView);
        make.top.mas_equalTo(_qh_driverAvatarImageView.mas_bottom).with.inset(10);
        make.height.mas_equalTo(20);
    }];
    
    _qh_carNumberLabel = [[UILabel alloc] init];
    _qh_carNumberLabel.font = kDefaultFont;
    _qh_carNumberLabel.textColor = kDarkBlackColor;
    _qh_carNumberLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_carNumberLabel];
    [_qh_carNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_driverAvatarImageView);
        make.left.mas_equalTo(_qh_driverAvatarImageView.mas_right).with.offset(20);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(30);
    }];
    
    _qh_carInfoLabel = [[UILabel alloc] init];
    _qh_carInfoLabel.font = kDefaultFont;
    _qh_carInfoLabel.textColor = kDarkBlackColor;
    _qh_carInfoLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_qh_carInfoLabel];
    [_qh_carInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_carNumberLabel.mas_bottom);
        make.left.mas_equalTo(_qh_driverAvatarImageView.mas_right).with.offset(20);
        make.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.height.mas_equalTo(20);
    }];
    
    UIView *sectionView3 = [[UIView alloc] init];
    sectionView3.backgroundColor = kLightGrayColor;
    [self addSubview:sectionView3];
    [sectionView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_driverNameLabel.mas_bottom).with.offset(singleMargin);
        make.left.and.right.mas_equalTo(self);
        make.height.mas_equalTo(40);
    }];
    
    UILabel *statementLabel = [[UILabel alloc] init];
    statementLabel.font = kDefaultFont;
    statementLabel.text = @"郑重声明";
    statementLabel.textColor = kDarkBlackColor;
    statementLabel.textAlignment = NSTextAlignmentLeft;
    [sectionView3 addSubview:statementLabel];
    [statementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(sectionView3).with.inset(GQH_MARGIN_SINGLE);
        make.top.and.bottom.mas_equalTo(sectionView3).with.inset(10);
    }];
    
    _qh_contentWebView = [[UIWebView alloc] init];
    _qh_contentWebView.delegate = self;
    [self.contentView addSubview:_qh_contentWebView];
    [_qh_contentWebView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.and.right.mas_equalTo(self.contentView).with.inset(singleMargin);
        make.top.mas_equalTo(sectionView3.mas_bottom).with.inset(10);
        make.bottom.mas_equalTo(self.contentView.mas_bottom);
    }];
}

@end



// 消息页面Cell
@implementation GQHMessageCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self loadUserInterface];
    }
    return self;
}

- (void)loadUserInterface {
    
    _qh_timeLabel = [[UILabel alloc] init];
    _qh_timeLabel.font = kSmallerFont;
    _qh_timeLabel.textColor = kBlackColor;
    _qh_timeLabel.textAlignment = NSTextAlignmentLeft;
    _qh_timeLabel.layer.cornerRadius = 2.0;
    _qh_timeLabel.layer.masksToBounds = YES;
    _qh_timeLabel.backgroundColor = kLightGrayColor;
    [self.contentView addSubview:_qh_timeLabel];
    [_qh_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(25);
        make.centerX.mas_equalTo(self.contentView.mas_centerX);
    }];
    
    _qh_contentLabel = [[UILabel alloc] init];
    _qh_contentLabel.font = kSmallerFont;
    _qh_contentLabel.textColor = kDarkGrayColor;
    _qh_contentLabel.textAlignment = NSTextAlignmentLeft;
    _qh_contentLabel.numberOfLines = 0;
    [self.contentView addSubview:_qh_contentLabel];
    [_qh_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_qh_timeLabel.mas_bottom).with.offset(10);
        make.left.and.right.mas_equalTo(self.contentView).with.inset(GQH_MARGIN_SINGLE);
        make.bottom.mas_equalTo(self.contentView.mas_bottom);
    }];
}

@end
